<script>
	// import { createPhantom, Position } from "@phantom/wallet-sdk";

	export default {
		onLaunch() {
			// this.globalData.phantom = null; // 初始化 Phantom 钱包实例
		},
		onShow: async () => {
			console.log('App Show')

			var args = plus.runtime.arguments;

			const queryString = args.split('?')[1];


			// 将查询字符串拆分为键值对数组
			const paramsArray = queryString.split('&');
			const params = {};

			// 遍历键值对数组，构建参数对象
			paramsArray.forEach(param => {
				const [key, value] = param.split('=');
				if (key && value) {
					params[key] = decodeURIComponent(value);
				}
			});
			// 访问特定参数值
			const phantomEncryptionPublicKey = params['phantom_encryption_public_key'];
			const nonce = params['nonce'];
			const data = params['data'];
			
			
			console.log(nonce,'nonce');
			uni.request({
				url: 'http://192.168.1.115:3000/decrypt', //仅为示例，并非真实接口地址。
				data: {
					data,
					nonce,
					publicKey:phantomEncryptionPublicKey,
					secretKey:uni.getStorageSync('privateKey')
				},
				header: {
					'custom-header': 'hello' //自定义请求头信息
				},
				success: (res) => {
						
					console.log('res last',res.data.data);
				}
			});

			console.log(131);
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
</style>